import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

export function getAllUser() {
  return request({
    url: '/member/getAllUser',
    method: 'get'
  })
}

export function getAllUserPage(val) {
  return request({
    url: '/member/getAllUser?page=' + val,
    method: 'get',
    val
  })
}

// 员工管理
export function getStaff() {
  return request({
    url: '/member/getStaff',
    method: 'get'
  })
}

export function getStaffPage(val) {
  return request({
    url: '/member/getStaff?page=' + val,
    method: 'get',
    val
  })
}

export function deleteUser(data) {
  return request({
    url: '/member/deleteUser',
    method: 'post',
    data
  })
}

export function insertUser(data) {
  return request({
    url: '/member/insertUser',
    method: 'post',
    data
  })
}

export function updateUser(data) {
  return request({
    url: '/member/updateUser',
    method: 'post',
    data
  })
}

export function getRoles() {
  return request({
    url: '/member/getRoles',
    method: 'get'
  })
}

export function updateMessage(data) {
  return request({
    url: '/member/updateMessage',
    method: 'post',
    data
  })
}
